﻿/**
 * @file   FITKAbaqusAdaptorSurface.h
 * @brief Abaqus Part 适配器 用于读取INP过程中的surface解析
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date 2024-03-26
 */
#ifndef __FITKABAQUSADAPTORSURFACE__H__
#define __FITKABAQUSADAPTORSURFACE__H__

#include "FITKAbaqusAbstractAdaptor.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"

ForwardDeclarNS(Interface, FITKMeshSurface)
ForwardDeclarNS(Interface, FITKMeshSurfaceElement)
ForwardDeclarNS(Interface, FITKMeshSurfaceNode)
ForwardDeclarNS(AbaqusData, FITKDataCase)
ForwardDeclarNS(Interface, FITKModelSet)

namespace IO
{
    /**
     * @brief surface读写适配器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date 2024-03-27
     */
    class FITKAbaqusIOINPAPI FITKAbaqusAdaptorSurface : public FITKAbaqusAbstractAdaptor
    {
    public:
        explicit FITKAbaqusAdaptorSurface() = default;
        ~FITKAbaqusAdaptorSurface() = default;

        /**
         * @brief 获取适配器数据类型名
         * @return 适配器数据类型名
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        QString getAdaptorClass() override;

        /**
         * @brief 适配器读取
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool adaptR() override;

        /**
         * @brief 适配器写出
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool adaptW() override;

        /**
         * @brief 设置算例数据用于读写
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-19
         */
        void setCaseData(AbaqusData::FITKDataCase* caseData);

    private:
        /**
         * @brief 读取元素（ELEMENT）类型的表面
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-26
         */
        bool elementTypeR();
        /**
         * @brief 读取元素（NODE）类型的表面
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-26
         */
        bool nodeTypeR();
        /**
         * @brief 写出元素（ELEMENT）类型的表面
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-26
         */
        bool elementTypeW();
        /**
         * @brief 写出元素（NODE）类型的表面
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-26
         */
        bool nodeTypeW();
        /**
         * @brief 通过名称获取集合id以及模型id
         * @param[i] setName 模型名称
         * @param[o] modelId 模型id
         * @return Interface::FITKModelSet* 集合
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-19
         */
        Interface::FITKModelSet* getSetByName(QString setName, int& modelId);

        /**
         * @brief 模型数据是否包含集合类型
         * @param[i] setData 模型数据
         * @param[i] type 类型 Interface::FITKModelEnum::FITKModelSetType
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-19
         */
        bool isContainSetType(Interface::FITKModelSet* setData, int type);

    private:
        /**
         * @brief 算例数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-28
         */
        AbaqusData::FITKDataCase* _caseData{};
    };

    Register2FITKIOAdaptorFactory(INP, Interface::FITKMeshSurface, FITKAbaqusAdaptorSurface, 1)
        Register2FITKIOAdaptorFactory(INP, Interface::FITKMeshSurfaceElement, FITKAbaqusAdaptorSurface, 2)
        Register2FITKIOAdaptorFactory(INP, Interface::FITKMeshSurfaceNode, FITKAbaqusAdaptorSurface, 3)
}

#endif // !__FITKABAQUSADAPTORSURFACE__H__
